﻿// Ajax: Đăng nhập tài khoản
function UserLogin(form) {
    $('#loader').show();
    $.ajax({
        type: "Post",
        url: "/KhachHang/LoginPopup",
        data: "username=" + form.username.value + "&password=" + form.password.value,
        dataType: "Json",
        success: function (result) {
            $('#loader').hide();
            if (result.status==true) {
                window.location.reload();

            } else {
                alert("mat khau hoac email khong dung");
            }
        },
        error: function (result) {
            //$('#loading').hide();
            alert("Failure!");
        }
    });

    return false;
}

function LogOut() {
    $.ajax({
        type: "Post",
        url: "/KhachHang/Loggout",
        dataType: "Json",
        success: function (result) {
        },
        error: function (result) {
            //$('#loading').hide();
            alert("Failure!");
        }
    });
}
